from django import template
from django.template.defaultfilters import urlize

register = template.Library()


@register.filter(is_safe=True)
def urlize_blank(value):
    value = urlize(value, autoescape=None)
    url = value.replace('<a ', '<a target="_blank" ')
    return url